Skip to content

feat(server): Unified Grant Resolution - #183

Merged
mckaragoz merged 4 commits into
CodeBeamOrg:devfrom
mckaragoz:UnifiedCredentialResolution
Nov 30, 2026
Merged

mckaragoz merged 4 commits into
CodeBeamOrg:devfrom
mckaragoz:UnifiedCredentialResolution

Conversation

@mckaragoz

@mckaragoz mckaragoz commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #182

Unifies authentication credential resolution across UltimateAuth by making effective authentication mode and GrantDelivery the single source of truth.

This removes legacy session resolver precedence, eliminates implicit credential fallback, and establishes a deterministic resolution model across server authentication, validation, refresh, and Resource API integrations.

What's Changed

Unified Credential Resolution

  • Resolve the primary authentication credential according to the effective authentication mode:
    • PureOpaque / Hybrid: Opaque session credential.
    • PureJwt: JWT access token.
    • SemiHybrid: Access token resolution architecture prepared for future implementation.
  • Resolve credentials exclusively from the configured cookie or request header.
  • Respect effective grant delivery, application profiles, custom credential names, and header formats.
  • Remove implicit fallback between cookies, headers, bearer credentials, and query parameters.
  • Keep credential resolution separate from authentication and session validation.

Security and Configuration Consistency

  • Reject duplicate authentication cookies and multiple credential header values.
  • Reject malformed credentials instead of attempting alternative transports.
  • Add effective grant delivery collision validation for conflicting cookie and header names.
  • Separate incoming request header configuration from outgoing response header delivery.
  • Preserve Authorization: Bearer for incoming access tokens while allowing separate response header configuration.
  • Align CSRF evaluation with the effective authentication cookie delivery configuration.

Legacy Architecture Cleanup

  • Remove SessionResolution options, validators, and ordered resolver infrastructure.
  • Remove obsolete cookie, bearer, custom-header, and query-string session resolvers.
  • Consolidate session resolution around the unified transport credential resolver.
  • Replace the legacy validation credential resolver with the shared transport resolution mechanism.
  • Remove the obsolete UI/API-based PrimaryCredential policy and resolver.
  • Simplify dependency injection registrations and remove redundant infrastructure.

Resource API and Refresh Compatibility

  • Align Resource API credential extraction with the unified resolution model.
  • Preserve remote session validation for session-backed authentication modes.
  • Preserve independent JWT validation for PureJwt.
  • Resolve refresh tokens exclusively through their effective refresh grant delivery.
  • Remove implicit X-Refresh-Token precedence and fallback behavior.
  • Update development samples to use consistent JWT signing and verification key configuration.

Tests and Documentation

  • Add regression coverage for strict cookie/header resolution, missing credentials, malformed values, duplicate values, and transport conflicts.
  • Update session, validation endpoint, refresh, Resource API, CSRF, and server configuration tests.
  • Update configuration, authentication flow, and documentation-site content for the new resolution model.
  • Remove obsolete tests for the legacy resolver architecture.

Breaking Changes

  • UAuthServerOptions.SessionResolution and its related resolver configuration have been removed.
  • UAuthServerOptions.PrimaryCredential and its UI/API credential selection policy have been removed.
  • Query-string session credential resolution is no longer supported.
  • Credential sources are no longer evaluated in precedence order.
  • X-Refresh-Token is no longer implicitly accepted; applications must explicitly configure it as the refresh grant header.
  • Applications with custom authentication transports must align their incoming credentials with effective GrantDelivery settings.

Applications using the built-in default cookie and access-token delivery conventions generally require fewer changes.

@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.46465% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.32%. Comparing base (aa24841) to head (c0ee5a4).

Files with missing lines Patch % Lines
...nfrastructure/Credentials/GrantCredentialReader.cs 90.56% 1 Missing and 4 partials ⚠️
...dentials/AspNetCore/TransportCredentialResolver.cs 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #183      +/-   ##
==========================================
+ Coverage   88.17%   88.32%   +0.14%     
==========================================
  Files         626      620       -6     
  Lines       21799    21697     -102     
  Branches     2675     2643      -32     
==========================================
- Hits        19221    19163      -58     
+ Misses       1645     1613      -32     
+ Partials      933      921      -12     
Flag Coverage Δ
framework 88.32% <96.46%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mckaragoz
mckaragoz merged commit 5438b5b into CodeBeamOrg:dev Nov 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Design]: Unify Credential Resolution and Remove Legacy SessionResolution Options

1 participant